<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<th:block th:insert="~{include :: header('紫卡武器')}"/>
<th:block th:insert="~{include :: bootstrap-select-css}"/>
<style>
    a img {
        width: 50px;
        display: block;
    }

    a:hover img {
        transform: scale(3);
    }
</style>
<body>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="market-form-riven">
                <div class="select-list">
                    <ul>
                        <li>
                            <label for="itemName">武器名称： </label><input class="form-control" id="itemName"
                                                                           name="itemName"
                                                                           placeholder="itemName"
                                                                           type="text"/>
                        </li>
                        <li>
                            <a class="btn btn-success btn-rounded btn-sm" onclick="searchPre()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="container-div">
            <div class="row">
                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<th:block th:insert="~{include :: footer}"/>
<th:block th:insert="~{include :: bootstrap-select-js}"/>
<script th:inline="javascript">
    const prefix = ctx + "data/warframe/market/riven";
    $(function () {
        const options = {
            url: prefix + "/list",
            modalName: "紫卡武器",
            sortOrder: "desc",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            columns: [
                {
                    field: 'state',
                    radio: true
                },
                {
                    field: 'rivenId',
                    title: 'ID'
                },
                {
                    field: 'item_name',
                    title: '物品名称'
                },
                {
                    field: 'riven_type',
                    title: '紫卡类型'
                },
                {
                    field: 'group',
                    title: '分组'
                },
                {
                    field: 'mastery_level',
                    title: '段位限制'
                },
                {
                    field: 'thumb',
                    title: '图片链接',
                    formatter: function (value, row) {
                        const actions = [];
                        actions.push('<a href="#"><img src="https://warframe.market/static/assets/' + row.thumb + '" alt=""/></a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

    function searchPre() {
        $.table.search('market-form-riven', 'bootstrap-table');
    }

    function update() {
        $.operate.post(prefix + "/update")
    }

    function resetPre() {
        $("#market-form-riven")[0].reset();
        $.table.search('market-form-riven', 'bootstrap-table');
    }

</script>

</body>
</html>